package edu.thu.thss.rsa.yxy;

import java.math.BigInteger;

public class PublicKey {
	public BigInteger e = new BigInteger("65537"); // encryption exponent
	public BigInteger n; // public modulus

	
	public PublicKey(BigInteger n) {
		this.n = n;
	}
	
	public BigInteger getN() {
		return n;
	}

	public void setN(BigInteger n) {
		this.n = n;
	}
	
	public BigInteger getE() {
		return e;
	}

	// RSAEncrypt: just raise m to power e (3) mod n
	public BigInteger RSAEncrypt(BigInteger m) {
		return m.modPow(e, n);
	}

	// RSAVerify: same as encryption, since RSA is symmetric
	public BigInteger RSAVerify(BigInteger s) {
		return s.modPow(e, n);
	}
}
